#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=5e5+4;
int a[N],n,m,ans,yu[N];
bool bj=1;
signed main(){
    // freopen("knight.in","r",stdin);
    // freopen("knight.out","w",stdout);
    // ios::sync_with_stdio(0);
    // cin.tie(0),cout.tie(0);
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(i>1) bj=min(bj,(a[i]>=a[i-1]));
    }
    if(bj){
        for(int i=1;i<=n;i++) yu[i%m]+=a[i];
        for(int i=1;i<=n;i++){
            
        }
        return 0;
    }
}